package com.hdkj.educms.service.impl;

import com.hdkj.educms.entity.CmsBanner;
import com.hdkj.educms.mapper.CrmBannerMapper;
import com.hdkj.educms.service.CrmBannerService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 首页banner表 服务实现类
 * </p>
 *
 * @author lzx
 * @since 2022-5-12
 */
@Service
public class CrmBannerServiceImpl extends ServiceImpl<CrmBannerMapper, CmsBanner> implements CrmBannerService {

    @Cacheable(value = "banner",key = "'selectIndexList'")
    @Override
    public List<CmsBanner> selectallbanner() {
        QueryWrapper<CmsBanner> wrapper=new QueryWrapper<>();
        wrapper.orderByDesc("id").last("limit 5");
        List<CmsBanner> list = baseMapper.selectList(wrapper);
        return list;
    }
}
